const common = require('./webpack.common')
const { merge } = require('webpack-merge')
const { CleanWebpackPlugin } = require('clean-webpack-plugin')


const option = {

    mode: 'development',
    optimization: {

    },
    devServer: {
        contentBase: ['./public'],
        proxy: {
            '/api': {
                //http://localhost/api/users  -> https://api.github.com/api/users
                target: 'https://api.github.com',
                //https://api.github.com/api/users ->api.github.com/users
                pathRewrite: {
                    '^/api': 'vue-app-base'
                },
                changeOrigin: true, // 不使用localhost:8080 作为请求 Github的主机名
            }
        }
    },
    plugins: [
        new CleanWebpackPlugin(),
        new webpack.HotModuleReplacementPlugin()


    ]
}

const mergeConfig = merge(common)


module.exports = mergeConfig